﻿using MediatR;
using RBAC.Common.Domains;
using RBAC.Common.Dto;
using RBAC.Common.infrastructures.interfaces;
using RBAC.Enum;

namespace RBAC.api.Application.commond.RBAC
{
    public class RoleSelectHander : IRequestHandler<RoleSelectCommond, Rulst>
    {

        private
             readonly IbaseRpository<Role> _Role;

        public RoleSelectHander(IbaseRpository<Role> role)
        {
            _Role = role;
        }

        public async Task<Rulst> Handle(RoleSelectCommond request, CancellationToken cancellationToken)
        {
          
            var result=new Rulst() {Code=(int)Reult.success };

            var list=_Role.Query().ToList();    
            if(list!=null)
            {
                result.data = list;
                result.Code = (int)Reult.Redims;
            }

            return result;
           


        }
    }
}
